import { Navigate, useRoutes } from "react-router-dom";
import Error from "@/pages/404";
import Index from "@/pages/index";
import Login from "@/pages/login";
import SystemHome from "@/pages/Home/SystemHome";
import AccountSetting from "@/pages/Home/AccountSetting";
import MemberManage from "@/pages/Authority/MemberManage";
import RoleManage from "@/pages/Authority/RoleManage";
import Comprehensive from "@/pages/Finance/Comprehensive";
import Label from "@/pages/Operation/Label";
import Merchandise from "@/pages/Operation/Merchandise";
import Scene from "@/pages/Operation/Scene";
import Search from "@/pages/Operation/Search";
import Zone from "@/pages/Operation/Zone";
import EditOrder from "@/pages/order/orderManagment/editOrder";
import OrderDetail from "@/pages/order/orderManagment/orderDetail";
import OrderList from "@/pages/order/orderManagment/orderList";
import RefundGoodsDetail from "@/pages/order/refundGoods/RefundGoodsDetail";
import RefundGoodsList from "@/pages/order/refundGoods/RefundGoodsList";
import RefundMoneyDetail from "@/pages/order/refundMoney/RefundMoneyDetail";
import RefundMoneyList from "@/pages/order/refundMoney/RefundMoneyList";
import RefundReason from "@/pages/order/refundReason/RefundReason";
import AddProduct from "@/pages/product/addProduct";
import DelProduct from "@/pages/product/delProduct";
import ProductAudit from "@/pages/product/productAudit";
import ProductChange from "@/pages/product/productChange";
import ProductClassify from "@/pages/product/productClassify";
import ProductList from "@/pages/product/productList";
import ChangeProduct from "@/pages/product/changeProduct";
import UserDetails from "@/pages/user/userDetails";
import UserList from "@/pages/user/userList";
import UserPurchasingPower from "@/pages/user/userPurchasingPower";
import UserTags from "@/pages/user/userTags";
import DeductionManagement from "@/pages/promotion/deductionManagement";
import PromotionManagement from "@/pages/promotion/promotionManagement";
import PurchaseManagement from "@/pages/promotion/purchaseManagement";
import Commodity from "@/pages/Statistics/commodity";
import Transaction from "@/pages/Statistics/Transaction";

const Routers = () => {
  return useRoutes([
    {
      path: "/",
      element: <Navigate to={"/login"} />,
    },
    {
      path: "/login",
      element: <Login />,
    },
    {
      path: "/index",
      element: <Index />,
      children: [
        {
          index: "index",
          element: <SystemHome />,
        },
        //home
        {
          path: "SystemHome",
          element: <SystemHome />,
        },
        {
          path: "AccountSetting",
          element: <AccountSetting />,
        },
        //Authority
        {
          path: "MemberManage",
          element: <MemberManage />,
        },
        {
          path: "RoleManage",
          element: <RoleManage />,
        },
        //Finance
        {
          path: "Comprehensive",
          element: <Comprehensive />,
        },
        //Operation
        {
          path: "Label",
          element: <Label />,
        },
        {
          path: "Merchandise",
          element: <Merchandise />,
        },
        {
          path: "Scene",
          element: <Scene />,
        },
        {
          path: "Search",
          element: <Search />,
        },
        {
          path: "Zone",
          element: <Zone />,
        },
        //order  orderManagment
        {
          path: "EditOrder",
          element: <EditOrder />,
        },
        {
          path: "OrderDetail",
          element: <OrderDetail />,
        },
        {
          path: "OrderList",
          element: <OrderList />,
        },
        //order  refundGoods
        {
          path: "RefundGoodsDetail",
          element: <RefundGoodsDetail />,
        },
        {
          path: "RefundGoodsList",
          element: <RefundGoodsList />,
        },
        //order  refundMoney
        {
          path: "RefundMoneyDetail",
          element: <RefundMoneyDetail />,
        },
        {
          path: "RefundMoneyList",
          element: <RefundMoneyList />,
        },
        //order  RefundReason
        {
          path: "RefundReason",
          element: <RefundReason />,
        },
        // product
        {
          path: "AddProduct",
          element: <AddProduct />,
        },
        {
          path: "DelProduct",
          element: <DelProduct />,
        },
        {
          path: "ProductAudit",
          element: <ProductAudit />,
        },
        {
          path: "ProductChange",
          element: <ProductChange />,
        },
        {
          path: "ProductClassify",
          element: <ProductClassify />,
        },
        {
          path: "ProductList",
          element: <ProductList />,
        },
        {
          path: "ChangeProduct",
          element: <ChangeProduct />,
        },
        // user
        {
          path: "UserDetails",
          element: <UserDetails />,
        },
        {
          path: "UserList",
          element: <UserList />,
        },
        {
          path: "UserPurchasingPower",
          element: <UserPurchasingPower />,
        },
        {
          path: "UserTags",
          element: <UserTags />,
        },
        // promotion
        {
          path: "DeductionManagement",
          element: <DeductionManagement />,
        },
        {
          path: "PromotionManagement",
          element: <PromotionManagement />,
        },
        {
          path: "PurchaseManagement",
          element: <PurchaseManagement />,
        },
        // Statistics
        {
          path: "Commodity",
          element: <Commodity />,
        },
        {
          path: "Transaction",
          element: <Transaction />,
        },
      ],
    },
    {
      path: "*",
      element: <Error />,
    }])
};

export default Routers;
